home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / util / shell / AXshDemo131.lha / InstallDisk.lha / man / axsh.man < prev    next >
Encoding:
Text File  |  1993-12-31  |  16.8 KB  |  511 lines

  1. Monday 21-Sep-92 15:20:38
  2.  
  3. AXSH(1)                   USER COMMANDS            Version 1.26
  4.  
  5.  
  6. NAME
  7.     AXsh - a shell (command interpreter)
  8.  
  9. SYNOPSIS
  10.     AXsh
  11.  
  12. DESCRIPTION
  13.     AXsh, the AXshell, is a command  interpreter with a number of
  14.     convenient  features for interactive use that  are or are not
  15.     available with the standard AmigaDOS shell, including command
  16.     aliasing,history events, variables, filename and command name
  17.     completion , shell level protections and a number of built-in
  18.     commands.
  19.  
  20. OPTIONS
  21.     -con    Turn off carrier checking (console mode) and allow
  22.         superusers to run any program they like, even those
  23.         NOT in the /etc/rc file (they have to be in the path
  24.         though).
  25.  
  26.     -log    Keep log (AXsh:etc/adm/log.*)
  27.  
  28.     -user <user>
  29.         Accepts user without asking the password. Account for
  30.         the  user  must still exist in /etc/passwd.  In  this
  31.         mode  "login"  command  causes  relogin with the same
  32.         login  name.  This  option is useful with closed UUCP
  33.         systems,  where  getty is answering the calls and you
  34.         don't want to have two login-prompts.
  35.  
  36.     -nullmodem
  37.         Indicates that there will be no Carrier present and
  38.         AXsh should ignore any carrier loss.
  39.  
  40.  
  41. Command Line Editing
  42.     The command line editor has two modes depending on the 'term'
  43.     environmental variable (vt100 or ANSI). In ANSI-mode it sends
  44.     more bytes, so vt100-mode is recommended. Just make sure that
  45.     your emulation matches the setting. It seems that most vt100-
  46.     terminals really don't like to work with the ansi-mode.
  47.  
  48.     The editor knows about these commands:
  49.  
  50.     left/right ^B/^F    Moves cursor left and right
  51.     up/down    ^P/^N    Recalls history events
  52.     Shift-left    ^A    Goto the start of line
  53.     Shift-right   ^E    Goto the end of line
  54.     Shift-up, Shift-TAB    History completion
  55.     Backspace        Delete previous character
  56.     Delete            Delete current (next) character
  57.     ^D            Like Delete or display matching
  58.                 files if cursor is in the EOL
  59.     ^L, ^R            Refresh line
  60.     ^K            Delete to the end of line
  61.     ^U            Delete to the start of line
  62.     ^W            Delete previous word
  63.     ^X            Delete line
  64.     ^Y            Yank killed text back
  65.  
  66.     TAB (^I)        Try command/filename completion
  67.     Return/Newline (^J/^M)    End editing :-)
  68.  
  69.     HELP            String assigned in variable HELP
  70.     F1            String in variable F1
  71.      :             :
  72.      :             :
  73.     F20            String in variable F20
  74.  
  75. Command Line Parsing
  76.     A  simple  command  is  composed of a sequence of words.  The
  77.     first word specifies the command to be executed. One line can
  78.     have several commands separated with a semicolon (";").
  79.  
  80. Variable substitution
  81.     In case '$' is encountered, it is treated as an environmental
  82.     variable  and  the  variable is replaced by its value. If the
  83.     variable  is  to  be part of a word, it must be surrounded by
  84.     braces of some kind.  The substitution is not done inside the
  85.     quotes.  List  of  the  reserved and special variables may be
  86.     found elsewhere in this document.
  87.  
  88.     $name        Normal type, will (usually) select the whole
  89.             variable as is.
  90.     $name[select]    Selects only one word from the variable.
  91.             Numbering starts from zero. If the referenced
  92.             word doesn't exist,a NULL string is returned.
  93.     ${name}[select]    When the variable name contains spaces or '['
  94.             chars , it must be surrounded by braces.  Any
  95.             pair of "()", "[]" and "{}" are considered as
  96.             braces.
  97.     examples:
  98.  
  99.     > echo $user
  100.     root
  101.     > echo ${tty}/$[host] $(quota)kB
  102.     con7/amiga.pasbox.fi 30kB
  103.  
  104.     > echo ${s p a c e}
  105.  
  106.     You can still use $-sign by doubling it ($$->$).  Another way
  107.     to use $-sign is to preceed it with a back-slash (\).
  108.  
  109.     There is a special variable: $< , which reads a line from the
  110.     standard  input and that line is appended to the command line
  111.     as is. No future parsing is done to the string read.
  112.  
  113.     Each variable is inserted as a single argument, even if it
  114.     consists of several words. If you want to add something to the
  115.     same argument, you can use e.g.
  116.  
  117.         $[var1]" text "$var2    "a"\"$[var]\""b"
  118.  
  119. Command Separator
  120.     If  you  want  to execute several commands from a single line
  121.     you  can use ';' as a delimiter. This command separator works
  122.     only with command line, not from scripts.
  123.  
  124.     In script files semicolon is used as a comment-mark!
  125.  
  126.     e.g. "cd arc: ; ls"
  127.  
  128.     If  you  want  to use semicolon on its own, preceed it with a
  129.     backslash: "\;". The same applies to every special character.
  130.  
  131.     e.g. "echo ls \; more file\ name ; ls ; more file\ name"
  132.  
  133. History Events
  134.     History events allows you to call for already typed lines for
  135.     editing.  You  can use either cursor keys up/down or type the
  136.     !-character  and  the  command number. History numbers can be
  137.     found  out  with  the 'history'-command,which is built in the
  138.     getline-routine.  The  number  of  history-lines is fixed and
  139.     cannot  be set by user.  History completion may also be used.
  140.     Write  the start of the command line and press shift-TAB. The
  141.     history completion works almost like filename completion.
  142.  
  143. Command, history, directory and filename completion
  144.     The  command line editor offers you the ability to complete a
  145.     partial  filename  by  pressing TAB (^I). If the name matches
  146.     several  files  or directories, expansion is made only to the
  147.     extent  it  can  be made and a BELL (^G) is printed.  You can
  148.     also display all matching filenames by pressing ^D.  However,
  149.     the cursor should be in the end of the line.
  150.  
  151.     If you apply TAB (^I) to the first word on a line,the word is
  152.     treated  as a command and the completion is made accordingly.
  153.     If no perfect match was found on the command set,  a filename
  154.     completion is tried. Remember that these actions are separate
  155.     and  a  partial  completion  may  be  performed  in the ccomp
  156.     routine  before  passing  the partial filename to fcomp.  You
  157.     can do completions on redirections too.
  158.  
  159.     History  completions are also possible.  This function can be
  160.     invoked  using shift+cursor_up or shift-TAB.  It behaves like
  161.     fcomp and beeps    for a partial completion.
  162.  
  163. Aliases
  164.     The AX shell maintains a list of aliases that you can create,
  165.     display  and modify using the alias and unalias commands. The
  166.     shell  checks the beginning of each command line to see if it
  167.     matches a name of an existing alias.  If it does, the command
  168.     is reprocessed with the alias definition replacing its name.
  169.  
  170.     Aliases  shouldn't be nested .  An alias definition shouldn't
  171.     contain another alias as the first command, because the alias
  172.     substitution is made only once for each command. So,recursive
  173.     aliases  are  not  possible , but looping aliases are easy to
  174.     create. To break such loop, you may have to send successive
  175.     BREAKs (^C) for undefined period of time (depending on the
  176.     command inside the loop).
  177.         (ex. alias loop wait 10\;loop)
  178.  
  179.     You cannot make an alias for strings 'alias' or 'unalias', so
  180.     these commands are always accessible.
  181.  
  182.     Aliases  are  case-sensitive,  so  you can escape an alias by
  183.     typing the command using a different case.
  184.  
  185. I/O Redirection
  186.     The  following metachars indicate that the subsequent word is
  187.     the name  of a file to which the command's standard output is
  188.     redirected. Standard input cannot yet be redirected.
  189.     Redirection does not work with all of the shell builtins.
  190.  
  191.     >    Redirect  the standard output to a file . If the file
  192.         does not exist, it is created. If it does exist,it is
  193.         overwritten; its previous contents are lost.
  194.  
  195.     >>    Append the standard output. Like >, but places output
  196.         at the end of the file rather than overwriting it. If
  197.         the file does not to exist, it is created.
  198.  
  199.     |    Simple piping. Everything after the pipe symbol in the
  200.         command line is considered to be another command. The
  201.         piping uses temporary files created in T:.
  202.  
  203.     Redirection and piping can't be used simultaneously !
  204.  
  205. Command Execution
  206.     If  the  command is a AXshell built-in, the shell executes it
  207.     directly.   Otherwise,  the shell searches for a file by that
  208.     name with execute permission.  If the command-name contains a
  209.     /  or  a  :  the shell takes it as a pathname, but completely
  210.     ignores it. This way unsecure commands won't be executed. You
  211.     can also use this feature to supress alias-replacement.
  212.  
  213.     e.g. c:dir would use the command 'dir', not the alias for dir
  214.  
  215.     For superusers in local (console) mode things are not as
  216.     simple. Paths are used as is and the shell path is also
  217.     searched.
  218.  
  219. Signal Handling
  220.     The  AXshell normally ignores all signals.  Ctrl-D is checked
  221.     only if the ignoreeof-variable it SET. Ctrl-C it not yet used
  222.     for  anything.  It is upto the running program to acknowledge
  223.     break signals.  AXsh will exit if it detects an EOF situation
  224.     or a loss of carrier.  If  you  open  AXsh in a window with a
  225.     close-gadget, it can also be used to make AXsh exit.
  226.  
  227. Directory and filename expansion
  228.     The  shell expands all arguments containing ':' or '/' chars.
  229.     This  way  all external commands get the right parameters and
  230.     you  still  have  a consistent referencing in filesystem: you
  231.     can use '~/' to refer to home dir with any command.
  232.  
  233.     This expansion can be turned off by defining the 'f'-flag for
  234.     the command in AXsh:etc/rc.  This  means that the argument is
  235.     not a filename.
  236.  
  237.     Wildcard expansion isn't made by AXsh,but the command itself,
  238.     if it supports wildcards. This may change in the future.
  239.  
  240. Built-In Commands
  241.     Built-in commands are executed within the AXshell.
  242.  
  243.     ;    Null command.This command is interpreted,but performs
  244.         no action.  Actually this contains two null-commands.
  245.         In script files semicolon is used as a comment mark.
  246.  
  247.     alias [ name [ def ] ]
  248.         Assign "def" to the alias name. "name" is not allowed
  249.         to be "alias" or "unalias" .  If def is omitted , the
  250.         alias  name  is  displayed  along  with  its  current
  251.         definition. If both the name and def are omitted, all
  252.         aliases are displayed. The name is the first argument
  253.         and the definition is the second.
  254.  
  255.         e.g. alias help "man axsh"
  256.  
  257.         You can remove all aliases with "alias clear".
  258.  
  259.     cd [ dir ]
  260.         Change  the  shell's  working  directory to directory
  261.         dir.   If  no  argument  is given, change to the home
  262.         directory of the user. ~ denotes home directory and :
  263.         denotes  the  root  directory  of the current working
  264.         directory.  '..' is the parent directory and / is the
  265.         AXsh: assign or disk.
  266.  
  267.         "cd" may be omitted ,  if there is no command mathing
  268.         the directory name.
  269.  
  270.     echo    Just prints out everything to the output. Mainly used
  271.         on  script files for output.  The trailing newline is
  272.         not printed if the first argument is "-n" or the last
  273.         argument is "noline".
  274.  
  275.         Example: echo $realname has logged on $host
  276.  
  277.     execute script-file
  278.         Get the commands from a specified file. The execution
  279.         continues  until  the end of file is reached or if an
  280.         error occurs. Empty lines are skipped. Scripts can be
  281.         nested, but the recursion depth is limited.
  282.  
  283.         Since 1.3 you can also redirect the output of a script.
  284.  
  285.         "execute" may be omitted, if there is no command with
  286.         the same name as the script-file nor a directory with
  287.         the same name (currently this is impossible in Amiga).
  288.         "execute" still appears as the zeroth argument to the
  289.         script.  The  script file bit must also be set if you
  290.         plan to start the script with only its name !
  291.  
  292.     exit    The shell exits and hangs up, if remote connection.
  293.  
  294.     ftp file [file2 ..]
  295.         Will copy the file(s) to the home directory.
  296.  
  297.     internal
  298.         Lists all internal commands. It is still possible that
  299.         they aren't allowed to all users, depending on /etc/rc.
  300.  
  301.     login    Terminate a login and initiate a new one.
  302.  
  303.     protect modes file [file2 ..]
  304.         Parses the mode argument and then sets the protection
  305.         bits accordingly. You can set, clear and toggle ANY
  306.         defined bit, including group and world protection
  307.         bits.
  308.  
  309.         e.g.    protect go+r-w /etc/systemaliases
  310.  
  311.         However, THESE BITS ARE NOT USED in AXsh yet, but ls
  312.         shows them.
  313.  
  314.     quit    A null-command. Otherwise used to exit scripts.
  315.  
  316.     quota    Shows  home  filesystem , number of files used , disk
  317.         space used and usage limit. Will return warning level
  318.         (5) if the quota is exceeded.
  319.  
  320.     set [ var [ definition ] ]
  321.         Create or modify a shell variable.  There are several
  322.         predefined ones that cannot be changed and some, with
  323.         whom the changes are discarded. Actually all variables
  324.         are  currently  environmental  variables, but this is
  325.         supposed to change.
  326.  
  327.         The variable name is the first argument and the
  328.         definition is the second.
  329.  
  330.         From version 1.3 all AXsh variables are exported to 2.0
  331.         shell local variables. You also have a list of WORM-
  332.         variables that can only be set once (/etc/ForbiddenVars).
  333.  
  334.         e.g. set HELP "cat /etc/motd\n"
  335.  
  336.         -- System variables:
  337.  
  338.         user        user's login name
  339.         tty        which terminal 'line' the user uses
  340.         accesslevel    just what it says.
  341.         realname    full name of the user
  342.         home        user's home directory
  343.         host        current host name
  344.         dosv        system version
  345.         intime        time the user has been logged in (mins)
  346.  
  347.         -- Special variables:
  348.         autologout    in minutes - time between keystrokes
  349.                 in AXsh for automatic logout.
  350.  
  351.         language    What catalog to use. If the language
  352.                 is not found or the variable is not
  353.                 set, English is used.
  354.  
  355.                 Currently you can select one of these:
  356.                  suomi        (Finnish)
  357.                  français    (French)
  358.                  dansk        (Danish)
  359.                  español    (Spanish)
  360.                  svenska    (Swedish)
  361.                 Or use the default English.
  362.  
  363.         cwd     current working directory
  364.         quota     disk space currently used (in kB)
  365.  
  366.         lasterr     return code from the last command
  367.         ioerr     IoErr() returned by the last external command
  368.              Lasterr and ioerr are not seen in the variable list.
  369.  
  370.         term     terminal emulation (vt100 or ansi, def:ansi)
  371.         rows     number of rows on terminal (default: 24)
  372.         visual     name of the full screen editor (def: editor)
  373.         edscroll scroll length in lines (in editor)
  374.         prompt     the prompt format:
  375.              Variables:
  376.                %%    % itself
  377.                %d    current working directory
  378.                %h    command counter
  379.                %l    line (terminal)
  380.                %M    hostname
  381.                %q    actual quota/limit
  382.                %r    full name
  383.                %t    time (full time now, might change)
  384.                %u    username
  385.                %i    intime (in minutes)
  386.  
  387.              C-style special codes:
  388.                \e    ESC
  389.                \t    TAB
  390.                \n    Newline
  391.                \r    CR
  392.                \a    BEL
  393.  
  394.              Control codes:
  395.                ^L    Ctrl-l
  396.                ^G    Ctrl-g
  397.                etc..
  398.  
  399.              any other character as is, default prompt
  400.              is "%h.%d> "
  401.              Example:
  402.                set prompt "\\e[1m(%u)\\e[m %%%h \\e[7m%d\\e[m > "
  403.  
  404.              Notice that you have to double the backslashes,
  405.              because they have precedence over doublequotes.
  406.  
  407.         ignoreeof
  408.              if this variable is set, ^D will do exit..
  409.              It is actually reversed from the tcsh.
  410.  
  411.         HELP     You can create macros by defining these
  412.         F1     variables. e.g.
  413.         ..        set F1 "^a^d^d^d^drm^e"
  414.         F20     will goto start of line, delete 4 chars, add
  415.              "rm" and goto end of line when you press F1.
  416.              C-style codes and control characters are like in
  417.              the prompt.
  418.  
  419.         -- Special variables in scripts --
  420.  
  421.         argument Works only with a word specifier, not as $argument.
  422.              argument[0] is 'execute', argument[1] is the
  423.              script name (possibly including path) etc.
  424.              This variable is not seen in the variable list.
  425.  
  426.     sysinfo    Print out some information about the OS version etc.
  427.  
  428.     unalias word [word2 .. [wordn]]
  429.         Discard one or more aliases.
  430.  
  431.     unset var [var2 .. [varn] ]
  432.         Discard one or more shell variables.
  433.  
  434.     upload file [file2 ..]
  435.         Copies the file(s) to the system upload directory.
  436.  
  437.     uptime    Displays uptime and system load information.
  438.  
  439.     wait time
  440.         Goto sleep for time (in seconds). Wait can be stopped
  441.         with a keypress.
  442.  
  443.     which command
  444.         Will show from where the command is executed. e.g.
  445.  
  446.         %14 (root) AXsh:home/root/ 169 > which dir
  447.         AXsh ALIAS
  448.         DH0:Oldsys/C/Dir
  449.         c:dir
  450.  
  451.         Dir is an alias, but otherwise DH0:oldsys/c/dir would
  452.         have been executed. There is also another dir in the
  453.         command search path, c:dir.
  454.  
  455.     who    Displays uptime and load information with a list of the
  456.         users currently logged in.
  457.  
  458.     whoami    Print out your current login name
  459.  
  460.     write user text [text ..]
  461.         Will send the text to another user in the system.
  462.         If the user is not logged in, an error message is
  463.         displayed instead.
  464.  
  465. Special script file commands
  466.  
  467.     The if-construct is a bit lame, but there simply are some
  468.     more important features to think about..
  469.  
  470.     if    Keywords for if-else-endif -contruct.
  471.     else    The condition can be one of the forms :
  472.     endif        "foo" == "foo"
  473.             "bar" != "foobar"
  474.             exists file
  475.  
  476.         If you use variable, the form depends on the variable
  477.            $var != "foo" will become:
  478.            "" != "foo"    , if the variable is empty and
  479.            var != "foo"    , if the variable is unset
  480.  
  481.     goto label
  482.         Jumps to a defined label. It is an error if the label
  483.         doesn't exist.
  484.  
  485.     quit    Exits the script
  486.  
  487.     label: [command]
  488.         Command  labeling .  The command is optional, and the
  489.         label is ignored in the command execution. A label
  490.         name cannot have spaces in it.
  491.  
  492.     ; comment
  493.         Commenting. Starts a comment which proceeds to the
  494.         next end-of-line.
  495.  
  496. FILES
  497.     /bin/AXsh        AXsh executable
  498.     /etc/rc            Configuration file
  499.     /etc/ForbiddenVars    File holding all untouchable variables:
  500.                    <varname> [<number of sets allowed>]
  501.     /etc/GlobalLogin    Script executed at login, can be used to
  502.                 set system variables like POSTNEWS etc.
  503.                 Still executed with user's privileges.
  504.     ~/.lastlogin        Showed by the login shell at login.
  505.     ~/.logout        Script which is EXECUTEd at logout
  506.     ~/.login        Script which is EXECUTEd at login
  507.  
  508. SEE ALSO
  509.     login, exit, cd, execute
  510.  
  511.